*******************************************************************************************************************************************
*------------------------------------------------------------------ STUDY 1 --------------------------------------------------------------*
*---------- Why Are Right-Wing Voters Attracted to Dominant Leaders? Assessing Competing Theories of Psychological Mechanisms ------------*
*******************************************************************************************************************************************

*******************************************************************************************************************************************
*---------------------------------------------- Recodes and generates key variables ------------------------------------------------------*
*******************************************************************************************************************************************


*---------------------------------------------------------- DEPENDENT VARIABLES ----------------------------------------------------------*


*** Creates dependent variable across the five round of choices between non-dominant and dominant face ///
* and based on variable ("dominantrandom") tapping random placement of faces (dominant to the left/right), and which face is linked to 82 percent agreement (non-dominant or dominant)

* Round 1
generate DV1 = .
replace DV1 = 1 if q7a_1==1 & dominantrandom1==1
replace DV1 = 1 if q7a_1==1 & dominantrandom1==3
replace DV1 = 1 if q7a_1==2 & dominantrandom1==2
replace DV1 = 1 if q7a_1==2 & dominantrandom1==4

replace DV1 = 0 if q7a_1==1 & dominantrandom1==2
replace DV1 = 0 if q7a_1==1 & dominantrandom1==4
replace DV1 = 0 if q7a_1==2 & dominantrandom1==1
replace DV1 = 0 if q7a_1==2 & dominantrandom1==3

* Round 2
generate DV2 = .
replace DV2 = 1 if q7b_1==1 & dominantrandom2==1
replace DV2 = 1 if q7b_1==1 & dominantrandom2==3
replace DV2 = 1 if q7b_1==2 & dominantrandom2==2
replace DV2 = 1 if q7b_1==2 & dominantrandom2==4

replace DV2 = 0 if q7b_1==1 & dominantrandom2==2
replace DV2 = 0 if q7b_1==1 & dominantrandom2==4
replace DV2 = 0 if q7b_1==2 & dominantrandom2==1
replace DV2 = 0 if q7b_1==2 & dominantrandom2==3

* Round 3
generate DV3 = .
replace DV3 = 1 if q7c_1==1 & dominantrandom3==1
replace DV3 = 1 if q7c_1==1 & dominantrandom3==3
replace DV3 = 1 if q7c_1==2 & dominantrandom3==2
replace DV3 = 1 if q7c_1==2 & dominantrandom3==4

replace DV3 = 0 if q7c_1==1 & dominantrandom3==2
replace DV3 = 0 if q7c_1==1 & dominantrandom3==4
replace DV3 = 0 if q7c_1==2 & dominantrandom3==1
replace DV3 = 0 if q7c_1==2 & dominantrandom3==3

* Round 4
generate DV4 = .
replace DV4 = 1 if q7d_1==1 & dominantrandom4==1
replace DV4 = 1 if q7d_1==1 & dominantrandom4==3
replace DV4 = 1 if q7d_1==2 & dominantrandom4==2
replace DV4 = 1 if q7d_1==2 & dominantrandom4==4

replace DV4 = 0 if q7d_1==1 & dominantrandom4==2
replace DV4 = 0 if q7d_1==1 & dominantrandom4==4
replace DV4 = 0 if q7d_1==2 & dominantrandom4==1
replace DV4 = 0 if q7d_1==2 & dominantrandom4==3

* Round 5
generate DV5 = .
replace DV5 = 1 if q7e_1==1 & dominantrandom5==1
replace DV5 = 1 if q7e_1==1 & dominantrandom5==3
replace DV5 = 1 if q7e_1==2 & dominantrandom5==2
replace DV5 = 1 if q7e_1==2 & dominantrandom5==4

replace DV5 = 0 if q7e_1==1 & dominantrandom5==2
replace DV5 = 0 if q7e_1==1 & dominantrandom5==4
replace DV5 = 0 if q7e_1==2 & dominantrandom5==1
replace DV5 = 0 if q7e_1==2 & dominantrandom5==3


** Creates scale tapping preference for dominant face across the five rounds of choices (only used in correlation table reported in Table S.1.2 in Online Supplementary Material S.1)
egen DV_dominance = rowmean(DV1 DV2 DV3 DV4 DV5)


*-------------------------------------------------------- INDEPENDENT VARIABLES -----------------------------------------------------------------*

*** Creates independent variable tapping the relative agreement with the two candidates as the difference in agreement between the dominant candidate face and the non-dominant candidate face.
* Creates one variable for each round of choice
recode enighedpct1 (1=71) (2=72) (3=73) (4=74) (5=75) (6=76) (7=77) (8=78) (9=79) (10=80) (11=81) (12=82), generate(enigforskel1)
recode enighedpct2 (1=71) (2=72) (3=73) (4=74) (5=75) (6=76) (7=77) (8=78) (9=79) (10=80) (11=81) (12=82), generate(enigforskel2)
recode enighedpct3 (1=71) (2=72) (3=73) (4=74) (5=75) (6=76) (7=77) (8=78) (9=79) (10=80) (11=81) (12=82), generate(enigforskel3)
recode enighedpct4 (1=71) (2=72) (3=73) (4=74) (5=75) (6=76) (7=77) (8=78) (9=79) (10=80) (11=81) (12=82), generate(enigforskel4)
recode enighedpct5 (1=71) (2=72) (3=73) (4=74) (5=75) (6=76) (7=77) (8=78) (9=79) (10=80) (11=81) (12=82), generate(enigforskel5)

* Round 1
generate agreement_diff1 =.
replace agreement_diff1 = (82-enigforskel1) if dominantrandom1==1 | dominantrandom1==2
replace agreement_diff1 = (enigforskel1-82) if dominantrandom1==3 | dominantrandom1==4

* Round 2
generate agreement_diff2 =.
replace agreement_diff2 = (82-enigforskel2) if dominantrandom2==1 | dominantrandom2==2
replace agreement_diff2 = (enigforskel2-82) if dominantrandom2==3 | dominantrandom2==4

* Round 3
generate agreement_diff3 =.
replace agreement_diff3 = (82-enigforskel3) if dominantrandom3==1 | dominantrandom3==2
replace agreement_diff3 = (enigforskel3-82) if dominantrandom3==3 | dominantrandom3==4

* Round 4
generate agreement_diff4 =.
replace agreement_diff4 = (82-enigforskel4) if dominantrandom4==1 | dominantrandom4==2
replace agreement_diff4 = (enigforskel4-82) if dominantrandom4==3 | dominantrandom4==4

* Round 5
generate agreement_diff5 =.
replace agreement_diff5 = (82-enigforskel5) if dominantrandom5==1 | dominantrandom5==2
replace agreement_diff5 = (enigforskel5-82) if dominantrandom5==3 | dominantrandom5==4


*****Variabel for om enigheden er størst med den ikke-dominante kandidat (0) eller den dominante kandidat (1)
generate enig_domi1=.
replace enig_domi1 = 1 if dominantrandom1== 1
replace enig_domi1 = 1 if dominantrandom1== 2
replace enig_domi1 = 0 if dominantrandom1== 3 
replace enig_domi1 = 0 if dominantrandom1== 4

generate enig_domi2=.
replace enig_domi2 = 1 if dominantrandom2== 1
replace enig_domi2 = 1 if dominantrandom2== 2
replace enig_domi2 = 0 if dominantrandom2== 3 
replace enig_domi2 = 0 if dominantrandom2== 4

generate enig_domi3=.
replace enig_domi3 = 1 if dominantrandom3== 1
replace enig_domi3 = 1 if dominantrandom3== 2
replace enig_domi3 = 0 if dominantrandom3== 3 
replace enig_domi3 = 0 if dominantrandom3== 4

generate enig_domi4=.
replace enig_domi4 = 1 if dominantrandom4== 1
replace enig_domi4 = 1 if dominantrandom4== 2
replace enig_domi4 = 0 if dominantrandom4== 3 
replace enig_domi4 = 0 if dominantrandom4== 4

generate enig_domi5=.
replace enig_domi5 = 1 if dominantrandom5== 1
replace enig_domi5 = 1 if dominantrandom5== 2
replace enig_domi5 = 0 if dominantrandom5== 3 
replace enig_domi5 = 0 if dominantrandom5== 4


*** Party choice
recode q1 (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (7=7) (8=8) (9=9) (10 11=.), generate(party)
label define partyLB 1 "Soc Dem" 2 "Radikale" 3 "Konservative" 4 "SF" 5 "Liberal Alliance" 6 "Kristendemokraterne" 7 "Dansk Folkeparti" 8 "Venstre" 9 "Enhedslisten"
label values party partyLB

* Creates dummy variable for whether subject voted for a party from the leftwing ("0" or rightwing ("1") party block
recode party (1 2 4 9 = 0) (3 5 6 7 8 =1), generate(rightwing)


*** Politcal ideology measured as subjects' left-right self-placement on 0-1 scale reflecting most leftwing/liberal ("0") and rightwing/conservative ("1") position, respectively.
generate LR_Ideology = (q2_1-1)/10
summ LR_Ideology

* Creates categorical ideology variable with categories from "0" to "10"
generate ideologi_kat = q2_1 - 1


*** Ideology variable based on the ten policy questions from the Voting Advice Application (VAA)
recode q6_1 q6_4 q6_6 q6_8 q6_10 (1=5) (2=4) (3=3) (4=2) (5=1)
corr q6_1 q6_2 q6_3 q6_4 q6_5 q6_6 q6_7 q6_8 q6_9 q6_10
* Factor analysis to test if items form a common ideology scale
factor q6_1 q6_2 q6_3 q6_4 q6_5 q6_6 q6_7 q6_8 q6_9 q6_10, pcf factors(1)
predict ideology
summ ideology
generate ideo_10 = ideology-r(min)
summ ideo_10
* recodes to 0-1 scale with "0" and "1" indicating most leftwing/liberal ("0") and rightwing/conservative ("1") position, respectively.
generate ideology_10items = ideo_10/(r(max)-r(min))
summ ideology_10items


*** Social Dominance Orientation
alpha q4_1 q4_2 q4_3 q4_4 q4_5 q4_6 q4_7 q4_8
recode q4_3 q4_4 q4_7 q4_8 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
corr q4_1 q4_2 q4_3 q4_4 q4_5 q4_6 q4_7 q4_8
* recodes to 0-1 scale with "0" and "1" indicating min. and max. values, respectively
generate SDO = (q4_1+q4_2+q4_3+q4_4+q4_5+q4_6+q4_7+q4_8-8)/44
summ SDO


*** Rightwing Authoritarianism
alpha y3_1 y3_2 y3_3 y3_4 y3_5 y3_6 y3_7 y3_8
recode y3_2 y3_6 y3_7 y3_8 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
corr y3_1 y3_2 y3_3 y3_4 y3_5 y3_6 y3_7 y3_8
* recodes to 0-1 scale with "0" and "1" indicating min. and max. values, respectively
generate RWA = ((y3_1+y3_2+y3_3+y3_4+y3_5+y3_6+y3_7+y3_8)-8)/48
summ RWA


*** Need to Evaluate
alpha q19_1 q19_2 q19_3 q19_4 q19_5 q19_6, gen(nte)
* recodes to 0-1 scale with "0" and "1" indicating min. and max. values, respectively
generate NTE = (nte-1)/4
summ NTE


*------------------------------------------------------------- DEMOGRAPHICS AND BACKGROUND VARIABLES -------------------------------------------------------------*
*-------------------------------------------------- reported in OnlineSupplementary Materials S.1, Table S.1.1 ---------------------------------------------------*

*** Gender
recode gender (1=0 "female") (2=1 "male"), generate(sex)
tab sex

*** Age 
summ age

*** Education
tab education
recode education (1=1) (4=2) (2 3 = 3) (5=4) (6=5) (7=6) (8=7), generate(education1)
generate educ = (education1-1)/6

*** Regional belonging (creates dummy variables for the five regional categories)
tab region, generate(reg_)

*** Ideological self-placement
summ LR_Ideology

*** Social Dominance Orientation
summ SDO

*** Party preference
tab party

*** Rightwing Authoritarianiam
summ RWA


*------------------------------------------- Manipulation check for dominant versus non-dominant faces ---------------------------------------------*
*** Creates trait perception variables for dominant faces
egen Competence_DomiKand = rowmean(q8a_1 q8b_1 q8c_1 q8d_1 q8e_1)
egen Agreeable_DomiKand = rowmean(q8a_2 q8b_2 q8c_2 q8d_2 q8e_2)
egen Dominance_DomiKand = rowmean(q8a_3 q8b_3 q8c_3 q8d_3 q8e_3)

*** Creates trait perception variables for non-dominant faces
egen Competence_NonDomiKand = rowmean(q8f_1 q8g_1 q8h_1 q8i_1 q8j_1)
egen Agreeable_NonDomiKand = rowmean(q8f_2 q8g_2 q8h_2 q8i_2 q8j_2)
egen Dominance_NonDomiKand = rowmean(q8f_3 q8g_3 q8h_3 q8i_3 q8j_3)

*** Tests differences in perceived traits for dominant against non-dominant faces (reported in article in section "Dominance impressions" under "Materials and Methods" for Study 1) 
ttest Competence_DomiKand == Competence_NonDomiKand
ttest Agreeable_DomiKand == Agreeable_NonDomiKand
ttest Dominance_DomiKand == Dominance_NonDomiKand


*** Creates variables for relative perceived competence, agreeableness and dominance for each face choice across the five rounds (used in analyses reported in Online Supplementary Materials S.10)
** Creates relative perceptions of competence
* Round 1
generate Comp_perceived1 =.
replace Comp_perceived1 = (q8a_1 - q8f_1)
* Round 2
generate Comp_perceived2 =.
replace Comp_perceived2 = (q8b_1 - q8g_1)
* Round 3
generate Comp_perceived3 =.
replace Comp_perceived3 = (q8c_1 - q8h_1)
* Round 4
generate Comp_perceived4 =.
replace Comp_perceived4 = (q8d_1 - q8i_1)
* Round 5
generate Comp_perceived5 =.
replace Comp_perceived5 = (q8e_1 - q8j_1)

** Creates relative perceptions of agreeableness
* Round 1
generate Agree_perceived1 =.
replace Agree_perceived1 = (q8a_2 - q8f_2)
* Round 2
generate Agree_perceived2 =.
replace Agree_perceived2 = (q8b_2 - q8g_2)
* Round 3
generate Agree_perceived3 =.
replace Agree_perceived3 = (q8c_2 - q8h_2)
* Round 4
generate Agree_perceived4 =.
replace Agree_perceived4 = (q8d_2 - q8i_2)
* Round 5
generate Agree_perceived5 =.
replace Agree_perceived5 = (q8e_2 - q8j_2)

** Creates relative perceptions of dominance
* Round 1
generate Domi_perceived1 =.
replace Domi_perceived1 = (q8a_3 - q8f_3)
* Round 2
generate Domi_perceived2 =.
replace Domi_perceived2 = (q8b_3 - q8g_3)
* Round 3
generate Domi_perceived3 =.
replace Domi_perceived3 = (q8c_3 - q8h_3)
* Round 4
generate Domi_perceived4 =.
replace Domi_perceived4 = (q8d_3 - q8i_3)
* Round 5
generate Domi_perceived5 =.
replace Domi_perceived5 = (q8e_3 - q8j_3)



***********************************************************************************************************************************************************
************************ Correlation matrix for Online Supplementary Materials PART 1 (Online Supplementary Materials S.1 *********************************
***********************************************************************************************************************************************************

** Means and standard deviations for all variables except assigned condition of political agreement and the interaction between assigned political agreement and ideology
summ DV_dominance LR_Ideology SDO RWA NTE educ age sex reg_1 reg_2 reg_3 reg_4 reg_5

** Correlations between all variables except assigned condition of political agreement and the interaction between assigned political agreement and ideology
corr DV_dominance LR_Ideology SDO NTE educ age gender reg_1 reg_2 reg_3 reg_4 reg_5

* Correlations for RWA with other variables
foreach var in DV_dominance LR_Ideology SDO NTE educ age gender reg_1 reg_2 reg_3 reg_4 reg_5 {
corr `var' RWA
}



***********************************************************************************************************************************************************
************************************************* Reshapes dataset to long format *************************************************************************
reshape long DV agreement_diff enig_domi dominantrandom Comp_perceived Agree_perceived Domi_perceived, i(identity) j(round)
***********************************************************************************************************************************************************
***********************************************************************************************************************************************************


************************************************************************************************************************************************************
************************ Correlation matrix for Online Supplementary Materials PART 2 (Online Supplementary Materials S.1) *********************************
************************************************************************************************************************************************************

** Correlations for all variables with assigned condition of political agreement and the interaction between assigned political agreement and ideology
* Manually creates interaction term between ideology and agreement_diff
generate LRideology_agreediff = LR_Ideology * agreement_diff

** Means and standard deviations for assigned condition of political agreement and the interaction between assigned political agreement and ideology
summ agreement_diff LRideology_agreediff

* Correlations between assigned political agreement condition and the remaining variables
foreach var in DV LR_Ideology SDO RWA NTE educ age gender reg_1 reg_2 reg_3 reg_4 reg_5 {
corr `var' agreement_diff
}
 
 
* Correlations between interaction between assigned political agreement condition with ideology and the remaining variables
foreach var in DV LR_Ideology agreement_diff SDO RWA NTE educ age gender reg_1 reg_2 reg_3 reg_4 reg_5 {
corr `var' LRideology_agreediff
}



************************************************************************************************************************************************************
******************************************************** MAIN ANALYSES *************************************************************************************
************************************************************************************************************************************************************


****************************************************** Preliminary analyses ***************************************************************
* How have faces been pitted against each other across rounds?
tab dominante1 ikkedominante1 if round == 1
tab dominante2 ikkedominante2 if round == 2
tab dominante3 ikkedominante3 if round == 3
tab dominante4 ikkedominante4 if round == 4
tab dominante5 ikkedominante5 if round == 5

* Tests if subjects hold an average preference for dominant over non-dominant candidate faces. --> No difference from 0.5
prtest DV==0.5

* Do aggregate preferences for dominant over non-dominant candidate face differ across the five rounds? --> No!
logit DV i.round, cluster(identity)
margins, at(round=(1 2 3 4 5))
testparm i.round


*******************************************************************************************************************************************
******************************** Main effects of ideology on preference for dominant candidate face ***************************************
*******************************************************************************************************************************************


**** Results presented in Table 1 and the corresponding part of the main text
*** Main effect of ideology without controlling for demographics (Table 1: Model 1)
logit DV c.LR_Ideology, cluster(identity) or
logit DV c.LR_Ideology, cluster(identity)

*** Main effect of ideology controlling for demographics (Table 1: Model 2)
logit DV c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
logit DV c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)

* Estimating the likelihood that respondents choose the dominant face across political ideology (based on Model 2 in Table 1)
logit DV c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
margins, at(LR_Ideology=(0 (0.1) 1))

*** Main effect of ideology controlling for demographics AND POLITICAL AGREEMENT (Table 1: Model 3)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
logit DV c.agreement_diff c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)

* Estimating the likelihood that respondents choose the dominant face across political ideology (based on Model 3 in Table 1)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
margins, at(LR_Ideology=(0 (0.1) 1))

*** Main effect of ideology controlling for demographics, POLITICAL AGREEMENT & INTERACTION BETWEEN IDEOLOGY AND POL. AGREEMENT (Table 1: Model 4)
logit DV c.agreement_diff##c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
logit DV c.agreement_diff##c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)


**** Creates Figure 3 (based on Model 3 in Table 1)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or
margins, dydx(LR_Ideology) at(agreement_diff=(-11(1)11))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(-11 (1) 11) ///
xtitle(Political agreement (dominant cand. face - non-dominant cand. face)) ytitle("Marginal Effect of Ideology" "on Preference for Dominant Leader Face") title("") scheme(s2mono)


*************************************************************************************************************************************************************
************************************************** Online Supplementary Analyses ****************************************************************************
*************************************************************************************************************************************************************

***** S.4: Testing if political ideology interacts with squared political agreement 
logit DV c.agreement_diff##c.agreement_diff##c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
logit DV c.agreement_diff##c.agreement_diff##c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)


***** S.5 Testing if the relationship between political ideology and choice of dominant candidate face differs across the five rounds.
logit DV c.agreement_diff c.LR_Ideology##ib(1).round c.educ i.region c.age i.gender, cluster(identity) or
logit DV c.agreement_diff c.LR_Ideology##ib(1).round c.educ i.region c.age i.gender, cluster(identity)
testparm c.LR_Ideology#i.round

bys round: logit DV c.agreement_diff c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)
bys round: logit DV c.agreement_diff c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or


***** S.6 Testing if main results replicate using OLS regression (Linear Probability Model)
* Model 1: 
reg DV c.LR_Ideology, cluster(identity)

* Model 2:
reg DV c.LR_Ideology c.educ i.region age i.gender, cluster(identity)

* Model 3:
reg DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender, cluster(identity)

* Model 4:
reg DV c.agreement_diff##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)


***** S.7 Testing if main results replicate using a dichotomous ideology variable (0 = liberal; 1 = conservative) and ideology variable from VAA
** Dichotomous ideology variable
* Model 1: 
logit DV i.rightwing, cluster(identity)

* Model 2:
logit DV i.rightwing c.educ i.region age i.gender, cluster(identity)

* Model 3:
logit DV i.rightwing c.agreement_diff c.educ i.region age i.gender, cluster(identity)

* Model 4:
logit DV i.rightwing c.agreement_diff##i.rightwing c.educ i.region age i.gender, cluster(identity)


** VAA based ideology variable
* Model 1: 
logit DV c.ideology_10items, cluster(identity)

* Model 2:
logit DV c.ideology_10items c.educ i.region age i.gender, cluster(identity)

* Model 3:
logit DV c.ideology_10items c.agreement_diff c.educ i.region age i.gender, cluster(identity)

* Model 4:
logit DV c.ideology_10items c.agreement_diff##c.ideology_10items c.educ i.region age i.gender, cluster(identity)


***** S.8 Testing if educational attainment or Need to Evaluate moderates the relationship between ideology and face preferences
* Moderation by education?
logit DV c.agreement_diff c.LR_Ideology##c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology##c.educ i.region age i.gender, cluster(identity) or

* Moderation by Need to Evaluate?
logit DV c.agreement_diff c.LR_Ideology##c.NTE c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology##c.NTE c.educ i.region age i.gender, cluster(identity) or


***** S.9 Testing if conservatives or liberals constitute the main driver of the relationship between ideology and face preferences
*** Test A: Trichotomized ideology variable based on 11-point scale

** Analysis with trichotomized ideology variable (w. "5" as single moderate category)
recode ideologi_kat (0 1 2 3 4 = 0 "Liberal") (5 = 1 "Neutral") (6 7 8 9 10 = 2 "Conservative"), generate(ideo_tri)

* With "Neutrals" as reference category (Table S.9.A, Model 1)
logit DV c.agreement_diff ib(1).ideo_tri c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff ib(1).ideo_tri c.educ i.region age i.gender, cluster(identity) or

* With "Liberals" as reference category
logit DV c.agreement_diff ib(0).ideo_tri c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff ib(0).ideo_tri c.educ i.region age i.gender, cluster(identity) or

* Creates Figure S.9.A, Panel 1:
margins, at(ideo_tri=(0 (1) 2) agreement_diff=(-8 0 8))
marginsplot, recastci(rcap) ciopts(lpattern(solid)) recast(scatter) yline(0) xlabel(0 "Liberals" 1 "Neutrals" 2 "Conservatives")  ylabel(0(0.2)1) ///
xtitle(Political Ideology Trichotomized) ytitle(pred. prob. dominant face) title("") scheme(s2mono)

* Analysis with trichotomized ideology variable (w. "4, 5 and 6" as moderate category)
recode ideologi_kat (0 1 2 3 = 0 "Liberal") (4 5 6 = 1 "Neutral") (7 8 9 10 = 2 "Conservative"), generate(ideo_tri2)

* With "Neutrals" as reference category (Table S.9.A, Model 2)
logit DV c.agreement_diff ib(1).ideo_tri2 c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff ib(1).ideo_tri2 c.educ i.region age i.gender, cluster(identity) or

* With "Neutrals" as reference category
logit DV c.agreement_diff ib(0).ideo_tri2 c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff ib(0).ideo_tri2 c.educ i.region age i.gender, cluster(identity) or

* Creates Figure S.9.A, Panel 2:
margins, at(ideo_tri2=(0 (1) 2) agreement_diff=(-8 0 8))
marginsplot, recastci(rcap) ciopts(lpattern(solid)) recast(scatter) yline(0) xlabel(0 "Liberals" 1 "Neutrals" 2 "Conservatives")  ylabel(0(0.2)1) ///
xtitle(Political Ideology Trichotomized) ytitle(pred. prob. dominant face) title("") scheme(s2mono)


*** Test B: Testing curvilinear relationship between ideology and face preferences
* Linear prediction by political ideology, Table S.9.B, Model 1
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

* Creates Figure S.9.B, Panel A
margins, at(LR_Ideology=(0 (0.1) 1))
marginsplot, recastci(rline) ciopts(lpattern(dashed)) recast(line) yline(0) xlabel(0 (.1) 1)  ylabel(0(0.2)1) ///
xtitle(Ideological Self-Placement) ytitle(pred. prob. dominant face) title("") scheme(s2mono) name(linear_pred, replace)

** curvilinear prediction by political ideology, Table S.9.B, Model 2
logit DV c.agreement_diff c.LR_Ideology##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology##c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

* Creates Figure S.9.B, Panel B
margins, at(LR_Ideology=(0 (0.1) 1))
marginsplot, recastci(rline) ciopts(lpattern(dashed)) recast(line) yline(0) xlabel(0 (.1) 1)  ylabel(0(0.2)1) ///
xtitle(Ideological Self-Placement) ytitle(pred. prob. dominant face) title("") scheme(s2mono) name(curvelin_pred, replace)

graph combine linear_pred curvelin_pred


*** Test C: Split on partisanship replicating analyses for conservative and liberal party supporters, respectively
* Liberal respondents only, Table S.9.C, Model 1: 
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender if rightwing == 0, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender if rightwing == 0, cluster(identity) or

* Creates Figure S.9.C, Panel A
margins, dydx(LR_Ideology) at(agreement_diff=(-11(1)11))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(-11 (1) 11) ///
xtitle(Political agreement (dominant cand. face - non-dominant cand. face)) ytitle("Marginal Effect of Ideology" "on Preference for Dominant Leader Face") title("Panel A (liberals)") scheme(s2mono) name(liberals, replace)

* Conservative respondents only, Table S.9.C, Model 2: 
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender if rightwing == 1, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology c.educ i.region age i.gender if rightwing == 1, cluster(identity) or

* Creates Figure S.9.C, Panel B
margins, dydx(LR_Ideology) at(agreement_diff=(-11(1)11))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(-11 (1) 11) ///
xtitle(Political agreement (dominant cand. face - non-dominant cand. face)) ytitle("Marginal Effect of Ideology" "on Preference for Dominant Leader Face") title("Panel B (conservatives)") scheme(s2mono) name(conservatives, replace)

* Interaction between party affiliation dummy (leftwing ("0") vs. rightwing ("1")) and ideology variable, Table S.9.C, Model 3
logit DV c.agreement_diff c.LR_Ideology##i.rightwing c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.LR_Ideology##i.rightwing c.educ i.region age i.gender, cluster(identity) or

* Combines Panel A and B of Figure S.9.C into one common figure
graph combine liberals conservatives


***** S.10 Testing if perceived dominance rather than perceiced competence or agreeableness drive the ideology interaction
** Table S.10, Model 1: Main relationships between perceived dominance, competence and agreeableness and choice of domiannt face morph (over non-dominant alternative)
logit DV c.agreement_diff c.Domi_perceived c.Comp_perceived c.Agree_perceived c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.Domi_perceived c.Comp_perceived c.Agree_perceived c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

** Interaction models for interactions between perceived dominance, competence and agreeableness, respectively, w. ideology on choice of domiannt face morph (over non-dominant alternative)
* One interaction at the time
** Table S.10, Model 2: Perceived Dominance X Ideology
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

** Table S.10, Model 3: Perceived Competence X Ideology
logit DV c.agreement_diff c.Comp_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.Comp_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

** Table S.10, Model 4: Perceived Agreeableness X Ideology
logit DV c.agreement_diff c.Agree_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.Agree_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

** Table S.10, Model 5: All three interactions simultaneously
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.Comp_perceived##c.LR_Ideology c.Agree_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.Comp_perceived##c.LR_Ideology c.Agree_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity) or

** Creates Figure S.11
* Panel A
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
margins, dydx(LR_Ideology) at(Domi_perceived=(-6(1)6))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(-6 (1) 6) ///
xtitle(Relative Dominnace Rating (dominant morph - non-dominant morph)) ytitle(Marg. Effect of Ideology on Choice of Dominant Face) title("") scheme(s2mono) name(Only_Domi)

* Panel B
logit DV c.agreement_diff c.Domi_perceived##c.LR_Ideology c.Comp_perceived##c.LR_Ideology c.Agree_perceived##c.LR_Ideology c.educ i.region age i.gender, cluster(identity)
margins, dydx(LR_Ideology) at(Domi_perceived=(-6(1)6))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(-6 (1) 6) ///
xtitle(Relative Dominnace Rating (dominant morph - non-dominant morph)) ytitle(Marg. Effect of Ideology on Choice of Dominant Face) title("") scheme(s2mono) name(All_Interactions)

* Creates one common Figure
graph combine Only_Domi All_Interactions


***** S.11 Testing the indirect relationship between SDO through political ideology on preferences for the dominant candidate face
* Table S.11, Model 1: Relationship between SDO and face preference 
logit DV c.agreement_diff c.SDO c.educ i.region c.age i.gender, cluster(identity)
logit DV c.agreement_diff c.SDO c.educ i.region c.age i.gender, cluster(identity) or

* Table S.11, Model 2: Simultaneous relationships between SDO and idoelogy, resepctively, and face preference 
logit DV c.agreement_diff c.SDO c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)
logit DV c.agreement_diff c.SDO c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or

* Correlation between ideology and SDO
pwcorr LR_Ideology SDO, sig

* Table S.11, Model 3: Testing if RWA also predicts face preference
logit DV c.agreement_diff c.RWA c.educ i.region c.age i.gender, cluster(identity)
logit DV c.agreement_diff c.RWA c.educ i.region c.age i.gender, cluster(identity) or

* Table S.11, Model 4: Testing the simultaneous relationships between SDO, ideology and RWA, resepctively, and face preference 
logit DV c.agreement_diff c.RWA c.SDO c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity)
logit DV c.agreement_diff c.RWA c.SDO c.LR_Ideology c.educ i.region c.age i.gender, cluster(identity) or
